
<style lang="less">
.navhead {
		padding: 0 30rpx;
		height: 88rpx;
		background: #fff;
		width: 100%;
		border-bottom: 1px solid #EDEDED;
		position: fixed;
		top: var(--status-bar-height);
		z-index: 99;
		.icon-zuo {
			font-size: 32rpx;
			color: #333;
		}
		.icon-sx{
			font-size: 40rpx;
		}
	}
	.distance{
		height: calc(88rpx + var(--status-bar-height));
	}
	.item{
		.item_title{
			height: 55rpx;
			font-size: 26rpx;
			color: #999;
			letter-spacing: 1px ;
		padding: 0 30rpx;
		}
		.item_content{
			width: 100%;
			padding: 30rpx 30rpx;
			background: #fff;
			.left_status{
				width: 100rpx;
				height: 100rpx;
				background: #F3404F;
				border-radius: 50%;
				color: #fff;
				font-size: 40rpx;
				align-self: flex-start;
			}
		}
		.right_c{
			flex: 1;
			margin: 0 0 0 30rpx;
			font-weight: 500;
			.one{
				font-size: 29rpx;
				color: #333;
			}
			.two{
				font-size: 29rpx;
				color: #333;
				letter-spacing: 1px ;
				margin: 20rpx 0 0;
			}
		}
	}
</style>
<template>
	<view style='min-height: 100vh;width: 100%;background: rgba(0,0,0,0.02);'>
		<view class="status_bar status_bar_bak"></view>
		<view class="navhead flex_r_between">
			<i class='iconfont icon-zuo' @click='$back'></i>
			<text>收益明细</text>
			<text></text>
			<!-- <i class='iconfont icon-sx'></i> -->
		</view>
		<view class="distance"></view>
		<view class="item" v-if="list.length">
			<!-- <view class="item_title flex_r_end">
				昨天
			</view> -->
			<view class="item_content flex_v_venter" v-for="(item,i) in list" :key="i">
				<view class="left_status flex_center" :style="item.delta > 0 ? '' : 'background-color:#63BEFC'">
					{{item.delta > 0 ? '收入' : '支出'}}
				</view>
				<view class="right_c">
					<view class="one flex_r_between">
						<text>{{item.delta > 0 ? `+${item.delta}` : `${item.delta}`}}金币</text>
						<text>{{item.createDate.split(' ')[0]}}</text>
					</view>
					<view class="two">
						{{item.event}}
					</view>
				</view>
			</view>
		</view>
		<view class="" v-else>
			<view class="flex_center" style="margin: 200rpx 0 0;font-size: 28rpx;letter-spacing: 1px;color: #ccc;">
				暂无数据
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				size:15,
				list:[]
			}
		},
		methods: {
			getList() {
				this.$ajax('/user/goldRecord',{page:this.page,size:this.size},'post').then(res => {
					if(res.data.obj.records.length){
						this.timer = true
						this.list = this.list.concat(res.data.obj.records)
						this.page++
						uni.hideLoading()
					}else{
						this.timer = false
						// Math.()
					}
				})
			}
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			uni.showLoading({
				title:'加载中'
			})
			if(this.timer){
				this.getList()
			}
		}
	}
</script>

